<template>
<view class="page"> 
	<template v-if="isLogin">
		<template v-if="loadingState.default">
			<loading :loadingState="loadingState"></loading>
		</template>
		
		<template v-else>
			<!-- 防控 -->
			<template v-if="params.pro_type==1">
				<template v-if="params.data_type=='fk'">
					<view class="body">
						<view class="map">
							<map id="map" :longitude="detail.pcdata.gcj02_lng" :latitude="detail.pcdata.gcj02_lat"
								:markers="markers" scale="16" show-location style="width: 100%; height: 150px;"></map>
						</view>
						<view class="data-list">				 
							<view class="item">
								<view class="label">天气情况</view>
								<text class="val">{{detail.pcdata.weather}}</text>
							</view>
							<view class="item">
								<view class="label">空气温度(°C)</view>
								<text class="val">{{detail.pcdata.temperature}}</text>
							</view>
							<view class="item">
								<view class="label">空气湿度(%)</view>
								<text class="val">{{detail.pcdata.humidity}}</text>
							</view>
							<view class="item">
								<view class="label">海拔</view>
								<text class="val">{{detail.pcdata.altitude|toFixedN(2)}}</text>
							</view>
						</view>
						<view class="hd-title">数据详情</view>
						
						<view class="detail-wrap m-b2">
							<view class="detail-item"> 
								<view class="label">地 址：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.pcdata.address}}</view> 
									</view>		 
								</view>			
							</view> 
							<view class="detail-item"> 
								<view class="label">经纬度：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.pcdata.d2ms_lng+'，'+detail.pcdata.d2ms_lat}}</view> 
									</view>		 
								</view>			
							</view> 
							<view class="detail-item">
								<view class="label">生境类型：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.pcdata.env_type}}</view> 
									</view>		 
								</view>			
							</view> 
							<view class="detail-item"> 
								<view class="label">防控面积：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.pcdata.fk_area}}</view> 
										<view class="link">亩</view>
									</view>		 
								</view>			
							</view>
							<!-- 人工防控 -->
							<template v-if="detail.pcdata.type==1">
								<view class="detail-item">
									<view class="label">粉剂用量：</view>
									<view class="detail-input">
										<view class="content">
											<view class="val">{{detail.pcdata.powder_count}}</view> 
											<view class="link">公斤</view>
										</view>		 
									</view>			
								</view> 
								<view class="detail-item">
									<view class="label">饵剂用量：</view>
									<view class="detail-input">
										<view class="content">
											<view class="val">{{detail.pcdata.bait_count}}</view> 
											<view class="link ">公斤</view>
										</view>		 
									</view>			
								</view>
								<view class="detail-item">
									<view class="label">扑杀蚁巢数：</view>
									<view class="detail-input">
										<view class="content">
											<view class="val">{{detail.pcdata.kill_count}}</view> 
											<view class="link ">个</view>
										</view>		 
									</view>			
								</view> 
							</template>
							
							<!-- 无人机防控 -->
							<template v-if="detail.pcdata.type==2">
								<view class="detail-item">
									<view class="label">飞手姓名：</view>
									<view class="detail-input">
										<view class="content">
											<view class="val">{{detail.pcdata.hands}}</view>  
										</view>		 
									</view>			
								</view>
								<view class="detail-item">
									<view class="label">作业架次：</view>
									<view class="detail-input">
										<view class="content">
											<view class="val">{{detail.pcdata.sortie}}</view> 
											<view class="link ">架次</view>
										</view>		 
									</view>			
								</view>
								<view class="detail-item">
									<view class="label">用药数量：</view>
									<view class="detail-input">
										<view class="content">
											<view class="val">{{detail.pcdata.bait_count}}</view> 
											<view class="link ">公斤</view>
										</view>		 
									</view>			
								</view>
							</template>
							
							
							
							<view class="detail-item"> 
								<view class="label">作业时间：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.pcdata.last_update_time}}</view> 
									</view>		 
								</view>			
							</view>
							<view class="detail-item">
								<view class="label">采集人员：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.realname}}</view> 
									</view>		 
								</view>			
							</view>					
						</view> 
						
						<view class="hd-title">作业照片</view>
						<view class="detail-wrap">
							<view class="detail-pic-item"> 
								<view class="detail-pic">				
									<view class="pic-item" v-for="(item,index) in detail.pcFiles" :key="index">
										<image src="@/static/images/filter_bg.png" mode="widthFix"><!-- 占位 --></image>
										<view class="img-wrap" @click="preview(index)">
											<image class="img" :src="img_path+item.file_path" mode="widthFix"></image>
										</view>					
									</view>  			 				 
								</view>			
							</view> 
						</view>
					</view> 
					
					<!-- 验收按钮 -->
					<view v-if="ys_project&&detail.pcdata.ys_status==0" class="ys-btn" @click="showCheckProject(detail.pcdata.ys_status)">
						<view class="icon">
							<image :src="web_host+'/wxicon/yanshou.png'" mode="widthFix"></image>
						</view>				 
					</view>
					
					<view class="footer">
						<view class="fix-wrap btn-wrap">
							<view class="item-horizontal flex-grow-1 blue" @click="del(detail.pcdata.id)">
								<view class="icon">
									<view class="iconfont icon-shanchu1 f-s40">&#xe74b;</view> 
								</view>				
								<view class="name">删除</view>
							</view>
							<view class="item-horizontal flex-grow-1 red" @click="openNavigation(detail.pcdata.gcj02_lat,detail.pcdata.gcj02_lng)">
								<view class="icon">
									<view class="iconfont icon-daohang f-s40">&#xe648;</view> 
								</view>
								<view class="name">导航</view>
							</view>					 
						</view>
					</view>	   
				</template>
				
				<template v-if="params.data_type=='fx'">
					<view class="body">
						<view class="map">
							<map id="map" :longitude="detail.last_pcdata.gcj02_lng" :latitude="detail.last_pcdata.gcj02_lat"
								:markers="markers" scale="16" show-location style="width: 100%; height: 150px;"></map>
						</view>
						<view class="data-list">				 
							<view class="item">
								<view class="label">天气情况</view>
								<text class="val">{{detail.last_pcdata.weather}}</text>
							</view>
							<view class="item">
								<view class="label">空气温度(°C)</view>
								<text class="val">{{detail.last_pcdata.temperature}}</text>
							</view>
							<view class="item">
								<view class="label">空气湿度(%)</view>
								<text class="val">{{detail.last_pcdata.humidity}}</text>
							</view>
							<view class="item">
								<view class="label">海拔</view>
								<text class="val">{{detail.last_pcdata.altitude}}</text>
							</view>
						</view>
						<view class="hd-title">数据详情</view>
						
						<view class="detail-wrap m-b2">
							<view class="detail-item"> 
								<view class="label">地 址：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.address}}</view> 
									</view>		 
								</view>			
							</view> 
							<view class="detail-item"> 
								<view class="label">经纬度：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.d2ms_lng+'，'+detail.last_pcdata.d2ms_lat}}</view> 
									</view>		 
								</view>			
							</view> 
							<view class="detail-item">
								<view class="label">生境类型：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.env_type}}</view> 
									</view>		 
								</view>			
							</view> 
							<view class="detail-item"> 
								<view class="label">调查面积：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.dc_area}}</view> 
										<view class="link">m²</view>
									</view>		 
								</view>			
							</view>
							<view class="detail-item">
								<view class="label">诱集工蚁数：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.trappers_count}}</view> 
										<view class="link">头/瓶</view>
									</view>		 
								</view>			
							</view> 
							<view class="detail-item"> 
								<view class="label">活蚁巢数：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.nests_count}}</view> 
										<view class="link ">{{detail.nests_count_unit}}</view>
									</view>		 
								</view>			
							</view>
							<view class="detail-item">
								<view class="label">总评等级：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.re_level}}</view> 
										<view class="link ">级</view>
									</view>		 
								</view>			
							</view> 
							<view class="detail-item"> 
								<view class="label">作业时间：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.last_pcdata.last_update_time}}</view> 
									</view>		 
								</view>			
							</view>
							<view class="detail-item">
								<view class="label">采集人员：</view>
								<view class="detail-input">
									<view class="content">
										<view class="val">{{detail.realname}}</view> 
									</view>		 
								</view>			
							</view>					
						</view> 
						
						<view class="hd-title">作业照片</view>
						<view class="detail-wrap">
							<view class="detail-pic-item"> 
								<view class="detail-pic">				
									<view class="pic-item" v-for="(item,index) in detail.pcFiles" :key="index">
										<image src="@/static/images/filter_bg.png" mode="widthFix"><!-- 占位 --></image>
										<view class="img-wrap" @click="preview(index)">
											<image class="img" :src="img_path+item.file_path" mode="widthFix"></image>
										</view>					
									</view>  			 				 
								</view>			
							</view> 
						</view>
					</view> 
					
					<!-- 验收按钮 -->
					<view v-if="ys_project&&detail.last_pcdata.ys_status==0" class="ys-btn" @click="showCheckProject(detail.last_pcdata.ys_status)">
						<view class="icon">
							<image :src="web_host+'/wxicon/yanshou.png'" mode="widthFix"></image>
						</view>				 
					</view>
					
					
					<view class="footer">
						<view class="fix-wrap btn-wrap">
							<view class="item-horizontal flex-grow-1 blue" @click="del(detail.pcdata.id)">
								<view class="icon">
									<view class="iconfont icon-shanchu1 f-s40">&#xe74b;</view> 
								</view>				
								<view class="name">删除</view>
							</view>
							<view class="item-horizontal flex-grow-1 red" @click="openNavigation(detail.last_pcdata.gcj02_lat,detail.last_pcdata.gcj02_lng)">
								<view class="icon">
									<view class="iconfont icon-daohang f-s40">&#xe648;</view> 
								</view>
								<view class="name">导航</view>
							</view>					 
						</view>
					</view>	  
								
				 
				</template>
				 
			</template>
			
			<!-- 监测 -->
			<template v-if="params.pro_type==2">
				<view class="body">
					<view class="map">
						<map id="map" :longitude="detail.last_pcdata.gcj02_lng" :latitude="detail.last_pcdata.gcj02_lat"
							:markers="markers" scale="16" show-location style="width: 100%; height: 150px;"></map>
					</view>
					<view class="data-list">				 
						<view class="item">
							<view class="label">天气情况</view>
							<text class="val">{{detail.last_pcdata.weather}}</text>
						</view>
						<view class="item">
							<view class="label">空气温度(°C)</view>
							<text class="val">{{detail.last_pcdata.temperature}}</text>
						</view>
						<view class="item">
							<view class="label">空气湿度(%)</view>
							<text class="val">{{detail.last_pcdata.humidity}}</text>
						</view>
						<view class="item">
							<view class="label">海拔</view>
							<text class="val">{{detail.last_pcdata.altitude|toFixedN(2)}}</text>
						</view>
					</view>
					<view class="hd-title">数据详情</view>
					
					<view class="detail-wrap m-b2">
						<view class="detail-item"> 
							<view class="label">地 址：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.address}}</view> 
								</view>		 
							</view>			
						</view> 
						<view class="detail-item"> 
							<view class="label">经纬度：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.d2ms_lng+'，'+detail.last_pcdata.d2ms_lat}}</view> 
								</view>		 
							</view>			
						</view> 
						<view class="detail-item">
							<view class="label">生境类型：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.env_type}}</view> 
								</view>		 
							</view>			
						</view> 
						<view class="detail-item"> 
							<view class="label">调查面积：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.dc_area}}</view> 
									<view class="link">亩</view>
								</view>		 
							</view>			
						</view>
						<view class="detail-item">
							<view class="label">诱集工蚁数：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.trappers_count}}</view> 
									<view class="link">头/瓶</view>
								</view>		 
							</view>			
						</view> 
						<view class="detail-item"> 
							<view class="label">活蚁巢数：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.nests_count}}</view> 
									<view class="link ">{{detail.nests_count_unit}}</view>
								</view>		 
							</view>			
						</view>
						<view class="detail-item">
							<view class="label">总评等级：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.re_level}}</view> 
									<view class="link ">级</view>
								</view>		 
							</view>			
						</view> 
						<view class="detail-item"> 
							<view class="label">作业时间：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.last_pcdata.last_update_time}}</view> 
								</view>		 
							</view>			
						</view>
						<view class="detail-item">
							<view class="label">采集人员：</view>
							<view class="detail-input">
								<view class="content">
									<view class="val">{{detail.realname}}</view> 
								</view>		 
							</view>			
						</view>					
					</view> 
					
					<view class="hd-title">作业照片</view>
					<view class="detail-wrap">
						<view class="detail-pic-item"> 
							<view class="detail-pic">				
								<view class="pic-item" v-for="(item,index) in detail.pcFiles" :key="index">
									<image src="@/static/images/filter_bg.png" mode="widthFix"><!-- 占位 --></image>
									<view class="img-wrap" @click="preview(index)">
										<image class="img" :src="img_path+item.file_path" mode="widthFix"></image>
									</view>					
								</view>  			 				 
							</view>			
						</view> 
					</view>
				</view> 
				
				<view class="footer">
					<view class="fix-wrap btn-wrap">
						<view class="item-horizontal flex-grow-1 blue" @click="showCheckProject(detail.last_pcdata.ys_status)">
							<view class="icon">
								<view class="iconfont icon-shanchu1 f-s40"></view> 
							</view>				
							<view class="name">删除</view>
						</view>
						<view class="item-horizontal flex-grow-1 red" @click="openNavigation(detail.last_pcdata.gcj02_lat,detail.last_pcdata.gcj02_lng)">
							<view class="icon">
								<view class="iconfont icon-daohang f-s40"></view> 
							</view>
							<view class="name">导航</view>
						</view>					 
					</view>
				</view>	  
			
			</template>
 
			<view class="share-btn" @click="shareAddress">
				<view class="icon">
					<image src="@/static/images/share_address_icon.png" mode="widthFix"></image>
				</view>				 
			</view>
		</template>
		
	</template>
	
	<view v-if="flag.isFullPage" class="full-fix-page">
		<view v-if="flag.isCheckProject" class="popup-wrap a-fadein">
			<view class="popup-type-model ">
				<view class="close-btn iconfont f-s34" @click="showPopup('hide')">&#xe624;</view>
				<view class="popup-body"> 
					<view class="title">项目验收</view>
					<view class="content">
						<view class="detail-wrap project-handle-area">
							<view class="detail-item m-b2">
								<view class="label">验收结果：</view>
								<radio-group class="detail-radio" @change="changeStatus">
									<view class="radio-item">
										<label>
											<text>通过</text><radio class="radio" value="1" :checked="params.current_status==1" color="#3399FF"/>
										</label>
									</view>	
									<view class="radio-item">
										<label>
											<text>不通过</text><radio class="radio" value="2" :checked="params.current_status==2" color="#3399FF"/>
										</label>
									</view>			 
								</radio-group>			
							</view> 
							<view class="form-item">
								<view class="form-textarea">
									<textarea class="inp-textarea" v-model="params.remark" placeholder="备注信息" maxlength="-1"></textarea> 
								</view>						
							</view> 
						</view> 
					</view>
				</view>
				<view class="btn-wrap"> 
					<view class="btn cancle" @click="showPopup('hide')">取消</view>
					<view class="btn confirm" @click="checkData">确定</view>
				</view>
			</view> 
		</view>
		  
	</view>
	

	
</view>
</template>

<script> 
import loading from '@/components/loading-more.vue'
import empty from '@/components/empty.vue'
import {img_path} from '@/config.js'
import {previewImage,d2Dms} from '@/common/util.js'
export default{
	name:'demo',
	data(){
		return{ 
			isLogin:false,
			loadingState:{
				default:true,
				loading:false,
				compelted:false
			},
			type:1,
			detail:{},
			flag:{
				isFullPage:false,
				isCheckProject:false
			},
			params:{
				id: '',
				pid: '',
				fid: '',
				action: '',
				pro_type:'',
				remark:'',
				status:1,
				current_status:1
			},
			markers:[],
			img_path:img_path,
			web_host:getApp().globalData.web_host,
			ys_project:false
		}
	},
	filters:{
		toFixedN:function(val,n){
			val=Number(val);
			return val.toFixed(n);
		}
	},
	onShow() {
		
	},
	async onLoad(params) { 
		this.params.pro_type=params.pro_type;
		this.params.id=params.id;
		this.params.pid=params.pid;
		this.params.fid=params.fid;
		if(params.data_type){
			this.params.data_type=params.data_type;
		}
		if(this.params.data_type=='fk'){
			uni.setNavigationBarTitle({
				title:'防控数据详情'
			}) 
		}else if(this.params.data_type=='fx'){
			uni.setNavigationBarTitle({
				title:'防效调查数据详情'
			}) 
		}
		this.isLogin = await this.$loginState('check');
		if(this.isLogin){
			
			if(this.params.data_type=='fk'){ 
				this.detail=await this.getFkdataInfo(); 
				this.getUserOperationAuth();
			}else if(this.params.data_type=='fx'){ 
				this.detail=await this.getPcDataDetail(); 
				this.getUserOperationAuth();
			}
			
		}
	},
	methods:{
		
		// 是否验收权限
		getUserOperationAuth:async function(){ 
			let res=await this.$api.user_api.getUserOperationAuth({
				action_code: 'ys_project',
				create_uid: this.detail.pcdata.create_uid
			})
			if(res.data.ret==0){
				this.ys_project=res.data.data.ys_project;
			} 
		},
		
		// 监测数据详情
		getPcDataDetail:async function(){
			let res=await this.$api.pro_api.getPcDataDetail({
				id: this.params.id,
				pid: this.params.pid,
				fid: this.params.fid,
				action: this.params.action
			})  
			console.log(res)
			if(res.data.ret==0){
				this.loadingState.default=false;
				res.data.data.pcdata.forEach((item,index)=>{
					let marker={};
					this.markers.push({
						id: index+1,
						latitude: parseFloat(item.gcj02_lat),
						longitude: parseFloat(item.gcj02_lng),
						iconPath: '../../static/images/mark4.png',
						width: '60',
						height: 40
					})
					if(item.last_update_time){
						item.d2ms_lat=d2Dms(parseFloat(item.gcj02_lat).toFixed(6));   // d2Dms方法 转为度分秒格式;
						item.d2ms_lng=d2Dms(parseFloat(item.gcj02_lng).toFixed(6));    // d2Dms方法 转为度分秒格式  
						if(item.altitude){
							item.altitude=parseFloat(item.altitude).toFixed(2);
						}
						res.data.data.last_pcdata=item;
					}
				})
				return res.data.data; 
			}else{
				this.loadingState.default=false;
			}
		},
		 
		
		// 防控数据详情
		getFkdataInfo:async function(){
			let res=await this.$api.pro_api.getFkdataInfo({
				id: this.params.id,
				pid: this.params.pid,
				fid: this.params.fid, 
			})  
			
			if(res.data.ret==0){
				this.loadingState.default=false;
				res.data.data.pcdata.d2ms_lat=d2Dms(parseFloat(res.data.data.pcdata.gcj02_lat).toFixed(6));   // d2Dms方法 转为度分秒格式;
				res.data.data.pcdata.d2ms_lng=d2Dms(parseFloat(res.data.data.pcdata.gcj02_lng).toFixed(6));    // d2Dms方法 转为度分秒格式 
				if(res.data.data.pcdata.altitude){
				  	res.data.data.pcdata.altitude=parseFloat(res.data.data.pcdata.altitude).toFixed(2);
				}
				let marker={};
				this.markers.push({
					id: 1,
					latitude: parseFloat(res.data.data.pcdata.gcj02_lat),
					longitude: parseFloat(res.data.data.pcdata.gcj02_lng),
					iconPath: '../../static/images/mark4.png',
					width: '60',
					height: 40
				}) 
				return res.data.data; 
			}else{
				this.loadingState.default=false;
			}
		},
		
		
		// 预览图片
		preview:function(idx){
			let data=[];
			this.detail.pcFiles.forEach(item=>{
				data.push(this.img_path+item.file_path)
			})
			previewImage({
				data:data,
				index:idx
			})
		},
		
		// 打开导航
		openNavigation: function(lat,lng) {
			uni.openLocation({
				latitude: parseFloat(lat),
				longitude: parseFloat(lng),
				name: this.detail.pcdata.address||this.detail.last_pcdata.address,
				address: this.detail.pcdata.address||this.detail.last_pcdata.address,
				scale: 18
			})
		},
		
		// 打开项目验收
		showCheckProject:function(status){
			if(status==0){
				this.showPopup('show','isCheckProject');
			}else{
				uni.showToast({
					icon: "none",
					title: '该项目已完成验收',
					mask: true 
				})
			}
		},
		
		// 切换验收项目状态
		changeStatus:function(e){ 
			this.params.current_status=e.detail.value;
		},
		
		// 防控验收项目
		checkData:async function(){ 
			let _this=this; 
			let res={};
			if(this.params.data_type=='fk'){  // 防控项目验收
				res=await this.$api.pro_api.fkProUpdate({
					id: this.params.id,
					pid: this.params.pid, 
					ys_status: this.params.status,    // 1 通过  2不通过
					ys_remark: this.params.remark, 
				})  
			}else {  // 防控数据验收
				res=await this.$api.pro_api.updatePcDataDetail({
					id: this.params.id,
					pid: this.params.pid,
					fid: this.params.fid,
					ys_status: this.params.status,    // 1 通过  2不通过
					ys_remark: this.params.remark, 
				}) 
			}
			
			if(res.data.ret==0){
				uni.showToast({
					icon: "success",
					title: '项目验收成功',
					mask: true,
					success() {
						setTimeout(()=>{
							_this.ys_project=false;
							_this.showPopup('hide');
						},500)
					}
				})
			}else{
				uni.showToast({
					icon: "none",
					image:"../../static/images/error.png",
					title: res.data.message,
					mask: true,
					success() {
						 
					}
				})
			}
		},		
		
		// 打开弹窗
		showPopup:function(t,n){
			if(t=='show'){
				this.flag.isFullPage=true;
				this.flag[n]=true;
			}else if(t=='hide'){
				for(let i in this.flag){
					this.flag[i]=false;
				}
			}
		},
		
		del:function(){
			let _this=this;
			if(this.params.data_type=="fk"){
				uni.showModal({
					content:"确定删除该数据吗？",
					async success(res) {
						if(res.confirm){
							let del_res=await _this.$api.pro_api.fkproDelete({
								id: _this.params.id,
								status: 0
							}) 
							if(del_res.data.ret==0){
								
								uni.showToast({
									icon:"success",
									title:"删除成功",
									mask:true,
									duration:1000,
									success() {
										setTimeout(()=>{
											_this.$store.commit('UPDATE_PRO_FK_LIST', 1);   // 删除成功更新列表  
											_this.$store.commit('UPDATE_PRO_FK_INFO', 1);   // 添加成功更新列表  
											uni.navigateBack({
												delta:1
											})
										},1000)
									}
								})
							}else if(del_res.data.ret==-2){
								uni.showToast({
									icon:"none",
									title:"删除失败，不能删除其他作业人员数据",
									mask:true,
									duration:1000,
									success() { 
									}
								})
							}else{
								uni.showToast({
									icon:"none",
									image:'../../static/images/error.png',
									title:del_res.data.message,
									mask:true,
									duration:1000,
									success() {
										 
									}
								})
							}
						}
					}
				})
			}else if(this.params.data_type=='fx'){ 
				uni.showModal({
					content:"确定删除该数据吗？",
					async success(res) {
						if(res.confirm){
							let del_res=await _this.$api.pro_api.pcproDeleteData({
								id: _this.params.id,
								status: 0
							}) 
							if(del_res.data.ret==0){								
								uni.showToast({
									icon:"success",
									title:"删除成功",
									mask:true,
									duration:1000,
									success() {
										setTimeout(()=>{
											_this.$store.commit('UPDATE_PRO_FKFX_LIST', 1);   // 删除成功更新列表  
											_this.$store.commit('UPDATE_PRO_FKFX_INFO', 1);   // 删除成功更新项目详情  
											uni.navigateBack({
												delta:1
											})
										},1000)
									}
								})
							} else if(del_res.data.ret==-2){
								uni.showToast({
									icon:"none",
									title:"删除失败，不能删除其他作业人员数据",
									mask:true,
									duration:1000,
									success() { 
									}
								})
							} else{
								uni.showToast({
									icon:"none",
									image:'../../static/images/error.png',
									title:del_res.data.message,
									mask:true,
									duration:1000,
									success() {
										 
									}
								})
							}
						}
					}
				})
			}
			
		},
		
		// 分享位置
		shareAddress:function(){ 
			if(this.params.data_type=='fk'){
				uni.share({
					provider:'weixin',
					type:0,
					title:this.detail.pcdata.address,
					href:`http://www.honghuoyi.com/plus/m_map.php?addr=${this.detail.pcdata.address}&longitude=${this.detail.pcdata.gcj02_lng}&latitude=${this.detail.pcdata.gcj02_lat}`,
					imageUrl:'../../static/images/share_area_icon.png',
					scene:'WXSceneSession',    // WXSceneTimeline  朋友圈    WXSceneSession 聊天界面
					summary:'',
					success:function(res){
						console.log(res)
					},
					fail(err) {
						console.log(err)
						if(err.code==-8){
							// 未安装应用
							uni.showModal({
								content:'未检测到客户端，请先下载安装客户端',
								mask:true,
								confirmText:'我知道了', 
								showCancel:false,
								success(m_res) {
									 
								}
							}) 
						}
					}
				})
			}else{
				uni.share({
					provider:'weixin',
					type:0,
					title:this.detail.last_pcdata.address,
					href:`http://www.honghuoyi.com/plus/m_map.php?addr=${this.detail.last_pcdata.address}&longitude=${this.detail.last_pcdata.gcj02_lng}&latitude=${this.detail.last_pcdata.gcj02_lat}`,
					imageUrl:'../../static/images/share_area_icon.png',
					scene:'WXSceneSession',    // WXSceneTimeline  朋友圈    WXSceneSession 聊天界面
					summary:'',
					success:function(res){
						console.log(res)
					},
					fail(err) {
						console.log(err)
						if(err.code==-8){
							// 未安装应用
							uni.showModal({
								content:'未检测到客户端，请先下载安装客户端',
								mask:true,
								confirmText:'我知道了', 
								showCancel:false,
								success(m_res) {
									 
								}
							}) 
						}
					}
				})
			}
			
		}
	},
	computed:{
		
	},
	components:{
		loading,
		empty
	}
}
</script>

<style scoped lang="less">
	.map{
		height: 300rpx;
		background: #ccc;
	}
	.data-list{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		background: #fff; 
		margin:0 auto 20rpx;
		padding:20rpx 0;
		border-top:1rpx dashed #ddd;
		.item{ 
			width:22%; 
			font-size:28rpx;
			text-align: center;
			.label{ 
				margin-bottom: 10rpx;
				color:#999;
			}
		}
	}
	.hd-title{
		margin-bottom: 20rpx;
		padding:0 20rpx; 
		border-left:10rpx solid #f00;
		font-size: 32rpx;
		font-weight: bold;
	}
	.project-handle-area{ 
		border-bottom: 0 none;
		.detail-item,.form-item{
			border-bottom:0 none;
		}
		.form-textarea{
			border:1rpx solid #ddd;
		}
	}
	.ys-btn{
		position: fixed;
		right:20rpx;
		bottom:120rpx;
		width: 120rpx;
		height: 120rpx;
		image{
			width: 100%;
		}
	}
	.share-btn{
		position: fixed;
		right:20rpx;
		bottom:250rpx;
		width: 120rpx;
		height: 120rpx;
		image{
			width: 100%;
		}
	}
</style>
